home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / aie8911.zip / LISTING.7 < prev    next >
Text File  |  1989-08-28  |  972b  |  38 lines

  1.  
  2.  
  3.                      Listing 6
  4.  
  5.           TRANSFORMATION TO COMPLETED ACTION
  6.  
  7.  
  8. done_it_prompt( Command, Done ) :-
  9.       action( Command, Action),
  10.       !,
  11.       object( Command, Object),
  12.       !,
  13.       singular( Object, S_object),
  14.       !,
  15.       past( Action, Past),
  16.       !,
  17.       concat([S_object, $ $, Past,$.$], Done).
  18.  
  19.      % find past form of verb given present
  20. past( Action, Past) :-
  21.       list_text( List, Action),     !,
  22.       reverse( List, List1),      !,
  23.       past_hlpr( List1, List2),   !,
  24.       reverse( List2, List3),     !,
  25.       list_text( List3, Past).
  26.  
  27. past_hlpr( [`s, `e | T] ,  [`d, `e | T] ) :- !.
  28. past_hlpr( [ `e | T] ,  [`d, `e | T] ) :- !.
  29. past_hlpr(   T  ,  [`d, `e | T] ) :- !.
  30.  
  31. singular( Plural, Singular) :-
  32.       string_length( Plural, N),
  33.       M is N-1  ,
  34.       nth_char(M, Plural, `s),
  35.       substring( Plural , 0, M, Singular).
  36.  
  37. ---------------- end of listing -----------------------------------
  38.